<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>1px 问题</title>
    <style>
        body {margin:0;padding:19px}
        div { padding:1em;margin:1em;}
        .box1{border-top: 1px solid #000;}
        /* .box2{border-bottom:0.5px solid #000;} */

        .box2{position: relative;border-bottom:1px solid #000;}
        .box2::after{
            content:'';
            position: absolute;
            left:0;top:0;width: 100%;
            height: 1px; 
            background-color: #000;
            transform: scaleY(0.5);
        }
    </style>
</head>
<body>
    <div class="box1">
        1px的上边框
    </div>

    <div class="box2">
        0.5px的上边框
    </div>
</body>
</html>